<template>
  <view class="setting-container page" :style="{height: `${windowHeight}px`}">
    <view class="list-cell list-cell-arrow" v-for="(item,index) in  list" :key="index" @click="toPage(item)" >
      <view class="menu-item-box" >
        <view>{{item.smallType}}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      windowHeight: uni.getSystemInfoSync().windowHeight,
      list:[
      ]
    }
  },
  onLoad() {
    this.getList();
  },
  methods: {
    getList(){
    this.$store.dispatch('GetDocList',{}).then(res => {
        this.list = res.data.records
      })

    },
    toPage(item){
      //如果item.smallType中包含‘民间借贷’,则跳转到民间借贷页面
      if(item.smallType.indexOf('民间借贷')!=-1) {
        uni.navigateTo({
          url: '/pages/docs/civilDoc?id='+item.id
        })
      }else{
        //提示暂时找不到该文件
        uni.showToast({
          title: '系统还未配置',
          icon: 'none',
          duration: 2000
        })
      }


    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  background-color: #ffffff;
}

.item-box {
  background-color: #FFFFFF;
  margin: 30rpx;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 10rpx;
  border-radius: 8rpx;
  color: #303133;
  font-size: 32rpx;
}
</style>
